import request from "@/utils/request";

export function loginByUsername(data) {
  return request({
    url: "/admin/login",
    method: "post",
    data
  });
}

/* QQ第三方登录 */
// export function loginByQQ(data) {
//   return request({
//     url: '/api/auth/loginByQQ',
//     method: 'get',
//     data: data
//   })
// }

export function logout() {
  return request({
    url: "/api/logout"
  });
}

export function getUserInfo(token) {
  return request({
    url: "/api/system/user/getCurrentUserInfo",
    method: "post",
    data: { token: token }
  });
}

// 获取图形验证码
export function postCaptcha(phone) {
  return request({
    url: "/admin/login/img",
    method: "post",
    data: { phone }
  });
}

// 验证图形验证码
export function postValiCaptcha(phone, x) {
  return request({
    url: "/admin/login/valiimg",
    method: "post",
    data: { phone, x }
  });
}

// 获取手机验证码
export function postPhoneCaptcha(phone, x) {
  return request({
    url: "/admin/login/sms",
    method: "post",
    data: { phone, x }
  });
}

export function getAdminMenu() {
  return request({
    url: "/access/menu/admin-menu",
    method: "get"
  });
}
